package com.asset.dispoal.business.bsEvidenceRecognition.domain.db.mapper;

import com.asset.dispoal.business.bsAgreement.dto.EvidenceDataRequest;
import com.asset.dispoal.business.bsEvidenceRecognition.domain.db.entity.EvidenceRecognition;
import com.asset.dispoal.business.bsEvidenceRecognition.domain.db.entity.EvidenceTypeSimpleDo;
import com.asset.dispoal.business.bsEvidenceRecognition.domain.db.entity.MatchSuccessEvidence;
import com.asset.dispoal.business.bsEvidenceRecognition.domain.db.entity.RemoveEvidenceContract;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.ContractEvidenceResponse;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.DeleteContractEvidenceRequest;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceBySingleContractDo;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceDeleteRequest;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceListRequest;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceListResponse;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceMatchHistoryFileRequest;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceMatchHistoryFileResponse;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceMatchHistoryRequest;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceMatchHistoryResponse;
import com.asset.dispoal.business.bsEvidenceRecognition.dto.EvidenceMatchRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tech.mhuang.pacebox.springboot.protocol.data.Page;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author qr
 * @date 2022/5/10$
 */
@Mapper
public interface BusinessDataManageMapper {


    /**
     * 根据机构查询证据
     *
     * @param request
     * @return
     */
    List<EvidenceRecognition> queryEvidence(EvidenceMatchRequest request);


    List<Map<String, String>> queryDataDetail(@Param("assetInstBatchId") String assetInstBatchId);


    List<Map<String, Object>> queryResult(@Param("assetInstBatchId") String assetInstBatchId, @Param("ListMap") List<Map<String, String>> map);

    Map<String, Object> queryContractResult(@Param("contractId") String contractId, @Param("ListMap") List<Map<String, String>> map);

    void batchMatching(@Param("idList") List<String> collect);

    void updateEvidenceRegnitionStateByEvidenceId(@Param("evidenceId") String evidenceId, @Param("evidenceItemId") String evidenceItemId, @Param("state") String state);

    void insertEvidenceMapper(@Param("id") String genMapperId, @Param("evidenceId") String evidenceId, @Param("alias") String param, @Param("result") Object matchResultObj);

    int queryCountEvidenceList(EvidenceListRequest evidenceListRequest);

    List<EvidenceListResponse> queryEvidenceList(Page<EvidenceListRequest> page);

    void deleteEvidence(EvidenceDeleteRequest evidenceDeleteRequest);

    int queryCountEvidenceHistory(EvidenceMatchHistoryRequest evidenceMatchHistoryRequest);

    List<EvidenceMatchHistoryResponse> queryEvidenceHistory(Page<EvidenceMatchHistoryRequest> page);

    int queryCountEvidenceHistoryFile(EvidenceMatchHistoryFileRequest evidenceMatchHistoryFileRequest);

    List<EvidenceMatchHistoryFileResponse> queryEvidenceHistoryFile(Page<EvidenceMatchHistoryFileRequest> page);

    List<ContractEvidenceResponse> queryEvidenceTypeByAssetInstBatchId(@Param("assetInstBatchId") String assetInstBatchId,
                                                                       @Param("evidenceTypeId") String evidenceTypeId,
                                                                       @Param("state") String state);

    List<EvidenceBySingleContractDo> querySingleContractEvidenceDo(@Param("contractMap") Map<String, Object> contractMap,
                                                                   @Param("assetInstBatchId") String assetInstBatchId);

    Set<String> queryRemoveIdByContractId(@Param("contractId") String contractId);

    void deleteContractEvidence(DeleteContractEvidenceRequest request);

    void updateEvidenceRegnitionStateByFaild(@Param("batchId") String batchId);

    List<MatchSuccessEvidence> queryMatchSuccessEvidence(@Param("assetInstBatchId") String assetInstBatchId,
                                                         @Param("evidenceTypeId") String evidenceTypeId,
                                                         @Param("state") String state);

    List<RemoveEvidenceContract> queryRemoveEvidenceContract(@Param("assetInstBatchId") String assetInstBatchId,
                                                             @Param("evidenceTypeId") String evidenceTypeId,
                                                             @Param("state") String state);

    List<Map<String, String>> queryResultByContractId(@Param("assetInstBatchId") String assetInstBatchId,
                                                      @Param("ListMap") List<Map<String, String>> mapList,
                                                      @Param("agreementIdList") List<String> agreementIdList);

    List<RemoveEvidenceContract> queryRemoveEvidenceContractByAgreementIdList(@Param("assetInstBatchId") String assetInstBatchI,
                                                                              @Param("agreementIdList") List<String> agreementIdList);

    List<EvidenceTypeSimpleDo> queryByEvidenceTypeIdList(@Param("assetInstBatchId") String assetInstBatchId,
                                                         @Param("evidenceTypeIdList") List<String> evidenceTypeIdList);

    List<Map<String, String>> queryResultByGather(@Param("assetInstBatchId") String assetInstBatchId,
                                                  @Param("ListMap") List<Map<String, String>> mapList);

    List<Map<String, Object>> queryResultByEvidenceDataRequest(@Param("request") EvidenceDataRequest request,
                                                               @Param("ListMap") List<Map<String, String>> mapList);

    String getContByEvidenceId(@Param("evidenceId") String evidenceId);

    void insertEvidenceMapperRecord(@Param("id") String genMapperId, @Param("evidenceId") String evidenceId, @Param("alias") String param, @Param("result") Object matchResultObj);

    List<MatchSuccessEvidence> queryMatchSuccessEvidenceByIdCard(String assetInstBatchId);

    List<RemoveEvidenceContract> queryRemoveEvidenceContractByIdCard(String assetInstBatchId);

    int updateTypeAndStatusSuccess(@Param("evidenceTypeId") String evidenceTypeId, @Param("recognitionId") String recognitionId);

    String queryRecognitionIdByUrl(String excludeBaseUrl);

    void updateEvidenceRecordState(@Param("recordId") String requestKey);
}
